{include file="public/header" /}
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <form class="layui-form layui-col-space5">
                        <div class="layui-inline layui-show-xs-block">
                            <select name="ispay" style="text-align:center">
                                <option value="">是否付款</option>
                                <option {if !empty(input('get.ispay')) && input('get.ispay')==1}selected{/if} value="1">
                                    未付款</option>
                                <option value="2" {if !empty(input('get.ispay')) && input('get.ispay')==2}selected{/if}>
                                    付款</option>
                            </select>
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <select name="payment">
                                <option value="">付款方式</option>
                                <option value="1" {if !empty(input('get.payment')) &&
                                    input('get.payment')==1}selected{/if}> 线下支付</option>
                                <option value="2" {if !empty(input('get.payment')) &&
                                    input('get.payment')==2}selected{/if}>微信支付</option>
                            </select>
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <select name="rece">
                                <option value="">售后状态</option>
                                <option value="1" {if !empty(input('get.rece')) && input('get.rece')==1}selected{/if}>正常
                                </option>
                                <option value="2" {if !empty(input('get.rece')) && input('get.rece')==2}selected{/if}>
                                    售后中
                                </option>
                            </select>
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <select name="status">
                                <option value="">订单状态</option>
                                <option value="1" {if !empty(input('get.status')) &&
                                    input('get.status')==1}selected{/if}>
                                    待付款</option>
                                <option value="2" {if !empty(input('get.status')) &&
                                    input('get.status')==2}selected{/if}>
                                    待配送</option>
                                <option value="3" {if !empty(input('get.status')) &&
                                    input('get.status')==3}selected{/if}>
                                    待收货</option>
                                <option value="4" {if !empty(input('get.status')) &&
                                    input('get.status')==4}selected{/if}>
                                    完成</option>
                                <option value="5" {if !empty(input('get.status')) &&
                                    input('get.status')==5}selected{/if}>
                                    取消</option>
                            </select>
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <input type="text" name="ordersn" placeholder="订单编号" value="{:input('get.ordersn')}"
                                autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <input type="text" name="createtime1" id='createtime1' placeholder="订单创建时间开始日期"
                                value="{:input('get.createtime1')}" autocomplete="off" class="layui-input">
                            <input type="text" name="createtime2" id='createtime2' placeholder="订单创建时间结束日期"
                                value="{:input('get.createtime2')}" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <input type="text" name="finishtime1" id='finishtime1' placeholder="订单完成时间开始日期"
                                value="{:input('get.finishtime1')}" autocomplete="off" class="layui-input">
                            <input type="text" name="finishtime2" id='finishtime2' placeholder="订单完成时间结束日期"
                                value="{:input('get.finishtime2')}" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <select name="atype" style="text-align:center">
                                <option value="">发货人类型【仅显示发货订单和完成订单】</option>
                                <option {if !empty(input('get.atype')) && input('get.atype')==1}selected{/if} value="1">
                                    商家</option>
                                <option {if !empty(input('get.atype')) && input('get.atype')==2}selected{/if} value="2">
                                    合伙人</option>
                            </select>
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="sreach">搜索</button>
                        </div>
                    </form>
                </div>
                <div class="layui-card-header">
                    共有数据：<strong id="count">{$list->total()}</strong> 条&nbsp;
                    当前订单累计营业额:{$sumtotal|default='0'}元(每(天|周)月营业额)统计请选择所属商家、完成时间日期段和发货人类型筛选结果统计即可
                </div>
                <div class="layui-card-body layui-table-body layui-table-main">
                    <table class="layui-table layui-form">
                        <thead>
                            <tr>
                                <th>ID</th>
                                <th>订单号</th>
                                <th>用户信息</th>
                                <th>店铺名称</th>
                                <th>配送信息</th>
                                <th>是否付款</th>
                                <th>付款方式</th>
                                <th>订单状态</th>
                                <th>售后状态</th>
                                <th>商品详情</th>
                                <th>订单金额</th>
                                <th>发货人类型</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            {foreach $list as $v}
                            <tr>
                                <td>{$v.id|default=''}</td>
                                <td>{$v.ordersn|default=''}</td>
                                <td>
                                    用户id:{$v.user.id|default=0}<br />
                                    {if !empty($v.user.nickName)}
                                    用户昵称:{$v.user.nickName|default=''}<br />
                                    {/if}
                                    {if !empty($v.user.mobile)}
                                    用户手机:{$v.user.mobile|default=''}<br />
                                    {/if}
                                    {if !empty($v.user.gender)}
                                    {$v.user.gender|default='未知'}
                                    {if $v.user.gender == 1}
                                    用户性别:男<br />
                                    {else/}
                                    用户性别:女<br />
                                    {/if}
                                    {else/}
                                    用户性别:未知<br />
                                    {/if}
                                </td>
                                <td>{$v.shop.title|default=''}</td>
                                <td>
                                    姓名:{$v.name|default=''}<br />
                                    联系电话:{$v.mobile|default=''}<br />
                                    省市区:{$v.province_name|default=''}{$v.city_name|default=''}{$v.area_name|default=''}<br />
                                    具体地址:{$v.address|default=''}<br />
                                </td>
                                <td>
                                    {if $v.ispay == 1}
                                    未付款
                                    {else/}
                                    已付款
                                    {/if}
                                </td>
                                <td>
                                    {$v.payment_text|default=''}
                                </td>
                                <td>
                                    {$v.status_text|default=''}
                                </td>
                                <td>
                                    {$v.rece_text|default=''}
                                    {if $v.rece == 2}

                                    {/if}
                                </td>
                                <td>
                                    <a title="查看" onclick="data_edit('操作','/shop/order_goods?ordersn={$v.ordersn}')"
                                        href="javascript:;" class="layui-btn layui-btn-normal">
                                        查看
                                    </a>
                                </td>
                                <td>{$v.total|default=0}元</td>
                                <td>
                                    {if $v.type == 1}
                                    商家
                                    {else/}
                                    合伙人
                                    {/if}
                                </td>
                                <td class="td-manage">
                                    {if !empty($admins)}
                                    请等待合伙人操作
                                    {else/}
                                    {switch $v.status}
                                    {case 2}
                                    <a title="配送订单"
                                        onclick="data_status('确定配送订单吗?',this,'/shop/order_status','{$v.id}',3)"
                                        href="javascript:;" class="layui-bg-orange layui-btn">
                                        配送订单
                                    </a>
                                    <a title="完成订单"
                                        onclick="data_status('确定完成订单吗?',this,'/shop/order_status','{$v.id}',4)"
                                        href="javascript:;" class="layui-btn-normal layui-btn">
                                        完成订单
                                    </a>
                                    <a title="取消"
                                        onclick="data_status('确定取消订单吗?',this,'/shop/order_status','{$v.id}',5)"
                                        href="javascript:;" class="layui-btn-danger layui-btn">
                                        取消
                                    </a>
                                    {/case}
                                    {case 3}
                                    <a title="完成订单"
                                        onclick="data_status('确定完成订单吗?',this,'/shop/order_status','{$v.id}',4)"
                                        href="javascript:;" class="layui-btn-normal layui-btn">
                                        完成订单
                                    </a>
                                    <a title="取消"
                                        onclick="data_status('确定取消订单吗?',this,'/shop/order_status','{$v.id}',5)"
                                        href="javascript:;" class="layui-btn-danger layui-btn">
                                        取消
                                    </a>
                                    {/case}
                                    {default /}
                                    <button class="layui-btn layui-bg-cyan">{$v.status_text|default=''}</button>
                                    {/switch}
                                    {/if}

                                </td>

                            </tr>
                            {/foreach}

                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body">
                    <div class="page">
                        {$list->render()|raw}
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>
</body>
<script>
    layui.use(['form', 'upload', 'laydate'], function () {
        var $ = layui.jquery
            , form = layui.form
            , layer = layui.layer;
        var laydate = layui.laydate;
        laydate.render({
            elem: '#finishtime1',
            type: 'datetime'
        });
        laydate.render({
            elem: '#finishtime2',
            type: 'datetime'
        });
        laydate.render({
            elem: '#createtime1',
            type: 'datetime'
        });
        laydate.render({
            elem: '#createtime2',
            type: 'datetime'
        });

    });
</script>
<script>
    layer.photos({
        photos: '#layer-photos'
        , anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
    });
</script>
{include file="public/footer"}